package com.javaxiaobear.base.framework.security;

import cn.dev33.satoken.jwt.SaJwtTemplate;
import cn.hutool.crypto.asymmetric.RSA;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.jwt.signers.AlgorithmUtil;
import cn.hutool.jwt.signers.JWTSigner;

public class RsaSaJwtTemplate extends SaJwtTemplate {
  @Override
  public JWTSigner createSigner(String keyt) {
    var rsa =
        new RSA(
            SpringUtil.getProperty("sa-token.rsa-private-key"),
            SpringUtil.getProperty("sa-token.rsa-public-key"));
    return new AsymmetricJWTSigner(AlgorithmUtil.getAlgorithm("RS256"), rsa);
  }
}
